﻿//  -------------------- iSharePoint -------------------- //
// 
//  Company:	IT Complex, LLC
//  Project:	Smart.Common
//  File name:	AddonCommon.cs
//  Developer:	Solomatov Igor
//  Created:	15.04.2012
// 
//  -------------------- iSharePoint -------------------- //

using Smart.Common.Entities;
using Smart.Common.Forms;
using Smart.Common.Notifications;
using Smart.Common.Rules;
//using Smart.Common.Templates;

namespace Smart.Common
{
	public class AddonCommon : Addon
	{
		public override void Register()
		{
			var config = SPServices.Configuration;
			var rootWeb = SPH.GetRootWeb();

			var nScope = new NotificationScope();
			nScope.SetDefaultSettings(config, rootWeb, Const.ScopeNames.Notifications, Const.ScopeNames.Notifications);
		}

		public override void Load()
		{
			// Generic
			EntityFactory.Register<Entity>();
			EntityFactory.Register<WebEntity>();
			//EntityFactory.Register<SqlEntity>();

			// Notifications
			EntityFactory.Register<NotificationTemplate>();
			EntityFactory.Register<NotificationItem>();

			EntityScope.Register<NotificationScope, INotificationScope>(Const.ScopeNames.Notifications);

			// Template services
			//TemplateFactory.Register<HtmlTemplateService, HtmlTemplate, HtmlInstance>(Const.Templates.Html);

			// Forms rules service
			RulesFactory.Register<FormsRulesService>(Const.Forms.DefaultRulesServiceName);
		}
	}
}